Full source code website bán hàng thương mại điện tử gần giống shopee
468.791 lượt xem;
1 <?
2 if (isset($_POST['butSaveLoai'])) {
3 $name = $_POST['txtName'];
4 $pass = $_POST['txtPass'];
5 $thutu = $_POST['thutu'];
6 $thutu_cat = $_POST['thutu_cat'];
7 $level = $_POST['txtLevel'];
8 $parent = $_POST['txtParent'];
9
10 if ($name=="")
11 {
12 echo "<p align=center class='err'>Bạn chưa nhập tên user</p>";
13 }
14 else
15 {
16 if (!empty($_POST['oldid'])) {
17 $oldid = $_POST['oldid'];
18 $sql = "update user set user='".$name."', pass='".$pass."' where id='".$oldid."'";
19 }
20 else
21 {
22 $sql = "insert into user (user,pass) values ('".$name."','".$pass."')";
23 }
24 if (mysql_query($sql,$con))
25 {
26 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
27 echo "<script>window.location='index.php?act=admin&page=".$_REQUEST['page']."'</script>";
28 }
29 else echo "<p align=center class='err'>Không thể cập nhật</p>";
30 }
31 }
32 ?>
33
34 <?
35 if (isset($_GET['id'])) {
36 $oldid=$_GET['id'];
37 $sql = "select * from user where id='".$oldid."'";
38 if ($result = mysql_query($sql,$con)) {
39 $row=mysql_fetch_array($result);
40 $name=$row['user'];
41 $pass=$row['pass'];
42 }
43 }
44 ?>
45
46 <form method="post" name="FormLoaiSP" action="index.php">
47 <input type=hidden name="act" value="admin_add">
48 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
49 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
50
51 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
52 <tr>
53 <td width="45%" align="center" class="title" height="20">Thêm mới / Cập nhật : Quản trị viên</td>
54 </tr>
55 <tr>
56 <td width="45%">
57 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
58 <tr>
59 <td width="15%" class="smallfont">
60 <p align="right">Tên đăng nhập</td>
61 <td width="1%" class="smallfont">
62 <font color="#FF0000">*</font></td>
63 <td width="83%" class="smallfont">
64 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
65 </tr>
66 <tr>
67 <td width="15%" class="smallfont">
68 <p align="right">Mật khẩu</td>
69 <td width="1%" class="smallfont">
70 <font color="#FF0000">*</font></td>
71 <td width="83%" class="smallfont">
72 <INPUT value="<? echo $pass; ?>" TYPE="text" NAME="txtPass" CLASS=textbox size="34"></td>
73 </tr>
74 <tr>
75 <tr>
76 <td width="15%" class="smallfont">
77 <p align="right">
78 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
79 <td width="1%" class="smallfont">
80 </td>
81 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
82 </tr>
83 </table>
84 </td>
85 </tr>
86 </table>
87 </form>
2 if (isset($_POST['butSaveLoai'])) {
3 $name = $_POST['txtName'];
4 $pass = $_POST['txtPass'];
5 $thutu = $_POST['thutu'];
6 $thutu_cat = $_POST['thutu_cat'];
7 $level = $_POST['txtLevel'];
8 $parent = $_POST['txtParent'];
9
10 if ($name=="")
11 {
12 echo "<p align=center class='err'>Bạn chưa nhập tên user</p>";
13 }
14 else
15 {
16 if (!empty($_POST['oldid'])) {
17 $oldid = $_POST['oldid'];
18 $sql = "update user set user='".$name."', pass='".$pass."' where id='".$oldid."'";
19 }
20 else
21 {
22 $sql = "insert into user (user,pass) values ('".$name."','".$pass."')";
23 }
24 if (mysql_query($sql,$con))
25 {
26 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
27 echo "<script>window.location='index.php?act=admin&page=".$_REQUEST['page']."'</script>";
28 }
29 else echo "<p align=center class='err'>Không thể cập nhật</p>";
30 }
31 }
32 ?>
33
34 <?
35 if (isset($_GET['id'])) {
36 $oldid=$_GET['id'];
37 $sql = "select * from user where id='".$oldid."'";
38 if ($result = mysql_query($sql,$con)) {
39 $row=mysql_fetch_array($result);
40 $name=$row['user'];
41 $pass=$row['pass'];
42 }
43 }
44 ?>
45
46 <form method="post" name="FormLoaiSP" action="index.php">
47 <input type=hidden name="act" value="admin_add">
48 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
49 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
50
51 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
52 <tr>
53 <td width="45%" align="center" class="title" height="20">Thêm mới / Cập nhật : Quản trị viên</td>
54 </tr>
55 <tr>
56 <td width="45%">
57 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
58 <tr>
59 <td width="15%" class="smallfont">
60 <p align="right">Tên đăng nhập</td>
61 <td width="1%" class="smallfont">
62 <font color="#FF0000">*</font></td>
63 <td width="83%" class="smallfont">
64 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
65 </tr>
66 <tr>
67 <td width="15%" class="smallfont">
68 <p align="right">Mật khẩu</td>
69 <td width="1%" class="smallfont">
70 <font color="#FF0000">*</font></td>
71 <td width="83%" class="smallfont">
72 <INPUT value="<? echo $pass; ?>" TYPE="text" NAME="txtPass" CLASS=textbox size="34"></td>
73 </tr>
74 <tr>
75 <tr>
76 <td width="15%" class="smallfont">
77 <p align="right">
78 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
79 <td width="1%" class="smallfont">
80 </td>
81 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
82 </tr>
83 </table>
84 </td>
85 </tr>
86 </table>
87 </form>